print( 2 *0.92)# 现金
def cash(total_price):
    return total_price

# 微信
def wechat(total_price):
    return total_price * 0.95

# 支付宝
def alipay(total_price):
    return total_price * 0.9

# 刷卡
def card(total_price):
    num = int(total_price / 100)
    return total_price - num * 20

# 输入商品单价和数量并检测
while True:
    unite_price = input("请输入商品单价(单位：元)：")
    if unite_price.isnumeric() and unite_price.count(".") <= 1:
        unite_price = float(unite_price)
        goods_count = input("请输入商品的数量：")
        if goods_count.isnumeric() and goods_count.count(".") <= 1:
            goods_count = float(goods_count)
            break
        else:
            print("非法字符，请重新输入\n")
            continue
    else:
        print("非法字符，请重新输入\n")
        continue

# 计算总金额并选择支付方式
total_price = float(unite_price * goods_count)
print(total_price)
print("你有四种付款方式：\n"
      "1.现金     没有折扣\n"
      "2.微信     0.95折\n"
      "3.支付宝    可获得基于总金额10%的鼓励金，可直接折算到付款金额\n"
      "4.刷卡     满100-20\n")

# 用列表存储支付方式的相关函数，并加以选择
while True:
    choice = int(input("请选择你的付款方式："))
    list_way = [0, cash(total_price), wechat(total_price), alipay(total_price), card(total_price)]
    if choice == 1:
        print(f"应付金额：{list_way[1]}")
        break
    elif choice == 2:
        print(f"应付金额：{list_way[2]}")
        break
    elif choice == 3:
        print(f"应付金额：{list_way[3]}")
        break
    elif choice == 4:
        print(f"应付金额：{list_way[4]}")
        break
    else:
        print("输入有误，请重新输入")
        continue